$(document).ready(function() {
	$(".new_address_xb").bind("click", xingbie);//选择性别
	$(".dz").bind("click", dizhi);//选择地址
});
//-----选择性别---------
function xingbie(){
	$(".xb_img").css("background","url('images/xuan_3.png')").css("background-size","20px 20px");
	$(this).children(".xb_img").css("background","url('images/xuan_4.png')").css("background-size","20px 20px");
}
//-----选择地址---------
function dizhi(){
	$(".dz_img").css("background","url('images/xuan_1.png')").css("background-size","30px 30px");
	$(this).children(".dz_img").css("background","url('images/xuan_2.png')").css("background-size","30px 30px");
}
//-----购物车---------
function shop(_idx){
	var imgObj = document.getElementById('shop_'+_idx);
	if(imgObj.getAttribute("src",2)=="images/xuan_2.png"){
	imgObj.src="images/xuan_1.png";
	}else{
	imgObj.src="images/xuan_2.png";
	}
}
function shop_quan(){
	var x=document.getElementsByName("imgshop");
	//alert(x.length);
	var Obj = document.getElementById('shop_0');
	if(Obj.getAttribute("src",2)=="images/xuan_2.png"){
	Obj.src="images/xuan_1.png";
		
		for(var i=0;i<x.length;i++){
		    var imgObj = document.getElementById('shop_'+i);
			if(imgObj.getAttribute("src",2)=="images/xuan_2.png"){
			imgObj.src="images/xuan_1.png";
			}
		}
	}else{
	Obj.src="images/xuan_2.png";
	
		for(var i=0;i<x.length;i++){
		    var imgObj = document.getElementById('shop_'+i);
			if(imgObj.getAttribute("src",2)=="images/xuan_1.png"){
			imgObj.src="images/xuan_2.png";
			}
		}
	}
}
//-----开关---------
function tjdd_ye_span2(_idx){
	var imgObj = document.getElementById('tjdd_ye_span2_'+_idx);
	if(imgObj.getAttribute("src",2)=="images/on.png"){
	imgObj.src="images/off.png";
	}else{
	imgObj.src="images/on.png";
	}
}
//-----消息提醒---------
function xxtx(_idx){
	var imgObj = document.getElementById('xxtx_span2_'+_idx);
	if(imgObj.getAttribute("src",2)=="images/on.png"){
	imgObj.src="images/off.png";
	}else{
	imgObj.src="images/on.png";
	}
}

//----------------------------------分类页面--------------------------------------------
function fenlei(){
		var w = document.documentElement.clientWidth || document.body.clientWidth || window.innerWidth;
		var h = document.documentElement.clientHeight || document.body.clientHeight || window.innerHeight;
		//alert(w);
		var h85 = h - 60;
		document.getElementById("fl_div5").style.height = h85+"px";
		document.getElementById("fl_div4").style.height = h85+"px";
		
		var oDiv=document.getElementById('fl_div4');
		var aBtn=oDiv.getElementsByTagName('a');
		var oDiv2=document.getElementById('fl_div5');
		var aDiv=oDiv2.getElementsByTagName('dl');
		
		for(var i=0;i<aBtn.length;i++){
			aBtn[i].index=i;
			aBtn[i].onclick=function(){
				for(var i=0;i<aBtn.length;i++){
					aBtn[i].className='';
					aDiv[i].style.display='none';
				}
				this.className='diancai_act';
				aDiv[this.index].style.display='block';
			}
		}
	}